package com.grape.dp.state.controller;


import com.grape.dp.state.service.OrderState;
import com.grape.dp.state.service.context.ContextState;
import com.grape.dp.state.utils.SpringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:OrderController
 * @author: myx
 * @date: 2019/7/29 0029
 * Copyright © 2019-grape. All rights reserved.
 */
@RestController
public class OrderController {

    @RequestMapping("/orderState")
    public String orderState(String stateBeanId) {
        OrderState orderState = SpringUtils.getBean(stateBeanId, OrderState.class);
        ContextState contextState = new ContextState(orderState);
        contextState.switchStateOrder();
        return "success";
    }
}
